﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace DockSample
{
    class StaticComplexRelationship : OriginalLine
    {
        public StaticComplexRelationship(Point point1, Point point2, OriginalDiagram startDiagram, OriginalDiagram endDiagram)
            : base(point1, point2, startDiagram, endDiagram)
        {
            //LineName = "StaticComplexRelationship";
        }

        public StaticComplexRelationship(Point point1, Point point2, string id, OriginalDiagram startDiagram, OriginalDiagram endDiagram)
            : base(point1, point2, id, startDiagram, endDiagram)
        {
            //LineName = "StaticComplexRelationship";
        }
        //***********************************************************************************
        public override void Drawing(Graphics g, DummyModelForm m)
        {
            Pen pen = new Pen(Color.Brown, 1);
            /*int r = 20;//半径
            int k = (GetEndShowPoint().Y - GetStartShowPoint().Y) / (GetEndShowPoint().X) - (GetStartShowPoint().X);//直线斜率
            int k0 = -1/k;
            int x0 = (GetStartShowPoint().X + GetEndShowPoint().X) / 2;
            int y0 = (GetEndShowPoint().Y + GetStartShowPoint().Y) / 2;
            int x = x0 - (int)Math.Sqrt((r*r)/(k0*k0+1));
            int y = y0 - k0 * (int)Math.Sqrt((r * r) / (k0 * k0 + 1));
            g.DrawEllipse(pen, new Rectangle(x, y, 10, 10));*/
            g.DrawEllipse(pen, new Rectangle((GetStartShowPoint().X + GetEndShowPoint().X) / 2 - 5, (GetEndShowPoint().Y + GetStartShowPoint().Y) / 2 - 5, 10, 10));

            base.Drawing(g, m);
        }
        //***********************************************************************************
        public override bool equalTo(OriginalLine line)
        {
            //判断直线反向相等
            if (endPoint == line.StartPoint && startPoint == line.EndPoint)
                return true;
            //判断相等
            return base.equalTo(line);
        }
    }
}

